﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////

// Reviewed
#pragma once

#include "GcmpModelInterface.h"
#include "IObject.h"

namespace gcmp
{
    class IUndoRedoElementsChangeEventArgs;
    class IDocument;
    /// \brief UndoRedo元素对象改变事件处理接口基类
    ///
    /// 需要监听元素对象改变事件，从这个类中继承
    class GCMP_MODEL_INTERFACE_EXPORT IUndoRedoElementsChangeEventHandler : public IObject
    {
        DEFINE_CAST_DERIVED(gcmp::IUndoRedoElementsChangeEventHandler, gcmp::IObject);
    public:
        /// \brief 事件函数
        /// \param pArgs 事件参数
        /// \return void
        /// \see IUndoRedoElementsChangeEventArgs.h
        virtual void On(const IUndoRedoElementsChangeEventArgs* pArgs) = 0;

        /// \brief 注册该处理器
        /// \param pDocument 文档指针
        /// \param pUndoRedoElementsChangeEventHandler 注册的处理器
        /// \return bool true代表成功，flase代表失败
        static bool Register(IDocument* pDocument, IUndoRedoElementsChangeEventHandler* pUndoRedoElementsChangeEventHandler);

        /// \brief 注销该处理器
        /// \param pDocument 文档指针
        /// \param pUndoRedoElementsChangeEventHandler 需注销的处理器
        /// \return bool true代表成功注销，flase代表注销失败
        static bool Unregister(IDocument* pDocument, IUndoRedoElementsChangeEventHandler* pUndoRedoElementsChangeEventHandler);
    };
}






